﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace _09_Broadcst
{
    class Program
    {
        static void Main(string[] args)
        {
            Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,ProtocolType.Udp);
            IPEndPoint iep1 = new IPEndPoint(IPAddress.Broadcast, 9050);
            string hostname = Dns.GetHostName();
            byte[] data = Encoding.ASCII.GetBytes("Hello broadcast");
            sock.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.Broadcast, 1);
            sock.SendTo(data, iep1);
            sock.Close();
            Console.ReadLine();

        }
    }
}
